home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Converters / Convert_MacPaint / Source / shared.subproj / RCS / generalFunctions.c,v < prev    next >
Text File  |  1995-06-12  |  1KB  |  45 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.1
  10. date     92.02.09.19.33.02;  author death;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @this file will, as time goes on, accumulate various functions that I seem to always
  17. be wanting (e.g. a function that determines if a given number is even or odd).
  18. @
  19.  
  20.  
  21.  
  22. 1.1
  23. log
  24. @Initial revision
  25. @
  26. text
  27. @//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  28. //    This function takes an unsigned number, and returns YES if the number is
  29. //    even, and NO otherwise.
  30. //    This test is accomplished simply by getting the remainder of dividing the number
  31. //    by 2.  This remainder will always be either 0 or 1.  If it is 1, then theNum was
  32. //    odd, otherwise it was even.
  33. //    This function is included here because this is occasionally a thing I need to make
  34. //    use of, but alas I always end up spending too much time remembering the operators
  35. //    needed to do it again.  
  36. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  37.  
  38. BOOL    EvenUnsignedNum (unsigned long int  theNum)
  39. {
  40.     if  ((theNum % 2) == 1)
  41.         return NO;
  42.     else
  43.         return YES;
  44. }@
  45.